[IA64] When a domU is destroyed, it will fall into NVRAM saving
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 12 Jun 2007 10:32:03 +0000 (11:32 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 12 Jun 2007 10:32:03 +0000 (11:32 +0100)
path. But if there is no NVRAM file for the domU, the save operation
would fail. Then domU blocked by Xend's exception. This patch fixs
that issue.

Signed-off-by: Zhang Xin <xing.z.zhang@intel.com>
tools/libxc/ia64/xc_ia64_hvm_build.c

index 0f41772fa13cc2630398f200bcb6cdb41621c583..522ec2d03cd32a468a150406376d1b2c0a62ebae 100644 (file)
@@ -712,11 +712,15 @@ int xc_ia64_save_to_nvram(int xc_handle, uint32_t dom)
        xc_get_hvm_param(xc_handle, dom, HVM_PARAM_NVRAM_FD, &nvram_fd);
 
        if ( !IS_VALID_NVRAM_FD(nvram_fd) )
-       {
                PERROR("Nvram not be initialized. Nvram save fail!\n");
-               return -1;
-       }
-       return copy_from_GFW_to_nvram(xc_handle, dom, (int)nvram_fd);   
+       else
+               copy_from_GFW_to_nvram(xc_handle, dom, (int)nvram_fd);  
+       
+       // although save to nvram maybe fail, we don't return any error number
+       // to Xend. This is quite logical because damage of NVRAM on native would 
+       // not block OS's executive path. Return error number will cause an exception 
+       // of Xend and block XenU when it destroy.
+       return 0;
 }
 
 #define NVRAM_FILE_PATH        "/usr/lib/xen/boot/nvram_"
@@ -862,7 +866,10 @@ setup_guest(int xc_handle, uint32_t dom, unsigned long memsize,
                nvram_start = 0;
        else
                if ( copy_from_nvram_to_GFW(xc_handle, dom, (int)nvram_fd ) == -1 )
+               {
                        nvram_start = 0;
+                       close(nvram_fd);
+               }
 
     vcpus = domctl.u.getdomaininfo.max_vcpu_id + 1;